home *** CD-ROM | disk | FTP | other *** search
- unit Propform;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls, DB, DBTables;
-
- type
- TTablePropertyForm = class(TForm)
- SelectedTable: TTable;
- DatabaseListBox: TListBox;
- TableListBox: TListBox;
- PropertyListBox: TListBox;
- SaveToFileButton: TButton;
- SaveToFileDialog: TSaveDialog;
- procedure FormCreate(Sender: TObject);
- procedure DatabaseListBoxClick(Sender: TObject);
- procedure TableListBoxClick(Sender: TObject);
- procedure SaveToFileButtonClick(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- TablePropertyForm: TTablePropertyForm;
-
- implementation
-
- {$R *.DFM}
-
- uses DBiTypes, DbiProcs;
-
- procedure TTablePropertyForm.FormCreate(Sender: TObject);
- begin
- Session.GetDatabaseNames(DatabaseListbox.Items);
- end;
-
- procedure TTablePropertyForm.DatabaseListBoxClick(Sender: TObject);
- begin
- TableListBox.Clear;
- PropertyListBox.Clear;
- Session.GetTableNames(
- DatabaseListBox.Items[DatabaseListbox.ItemIndex],
- '',
- True,
- False,
- TableListBox.Items
- );
- end;
-
- procedure TTablePropertyForm.TableListBoxClick(Sender: TObject);
- var
- SelectedTableProperty: CURProps;
- TheDatabaseName: DBINAME;
- TheDatabaseNameLength: Word;
- begin
- with SelectedTable do
- begin
- Close;
- DatabaseName := DatabaseListbox.Items[
- DatabaseListbox.ItemIndex
- ];
- TableName := TableListbox.Items[TableListbox.ItemIndex];
- Open;
- Check(
- DbiGetProp(
- hDBIObj( Handle) ,
- dbDATABASENAME,
- @(TheDatabaseName),
- sizeOf( TheDatabaseName ),
- TheDatabaseNameLength
- )
- );
- Check( DbiGetCursorProps( Handle, SelectedTableProperty ));
- end;
- with PropertyListBox.Items, SelectedTableProperty do
- begin
- Clear;
- Add( 'Database Name: ' + StrPas( TheDatabaseName));
- { table name (no extension, if it can be derived) }
- Add( 'Table Name: ' + StrPas( szName ));
- { Full file name size }
- Add( 'File Name Size: ' + IntToStr( iFNameSize ));
- { Driver type }
- Add( 'Table Type: ' + StrPas( szTableType ));
- { No of fields in Table }
- Add( 'Number of Fields: ' + IntToStr( iFields ));
- { Record size (logical record) }
- Add( 'Logical Record Size: ' + IntToStr( iRecSize ));
- { Record size (physical record) }
- Add( 'Physical Record Size: ' + IntToStr( iRecBufSize ));
- { Key size }
- Add( 'Key Size: ' + IntToStr( iKeySize ));
- { Number of indexes }
- Add( 'Number of Indexes: ' + IntToStr( iIndexes ));
- { Number of val checks }
- Add( 'Number of Validity Checks: ' + IntToStr( iValChecks ));
- { Number of Referential Integrity constraints }
- Add( 'Number of RIs: ' + IntToStr( iRefIntChecks ));
- { Bookmark size }
- Add( 'Bookmark Size: ' + IntToStr( iBookMarkSize ));
- { Stable book marks }
- Add( 'Stable Book Marks: ' +
- IntToStr( Integer( bBookMarkStable) ));
- { ReadOnly / RW }
- Add( 'Read Only: ' + IntToStr( Integer( eOpenMode )));
- { Excl / Share }
- Add( 'Share Mode: ' + IntToStr( Integer( eShareMode )));
- { Index is in use }
- Add( 'Index in Use: ' + IntToStr( Integer( bIndexed )));
- { 1: Has Seqnums; 0: Has Record# }
- Add( 'Seq/Rec Num: ' + IntToStr( iSeqNums ));
- { Supports soft deletes }
- Add( 'Soft Deletes: ' + IntToStr( Integer( bSoftDeletes )));
- { If above, deleted recs seen }
- Add( 'Deleted On: ' + IntToStr( Integer( bDeletedOn )));
- { Translate Mode }
- Add( 'Translate Mode: ' + IntToStr( Integer( exltMode )));
- { Restructure version number }
- Add( 'Restructure Version: ' + IntToStr( iRestrVersion ));
- { Cursor is uni-directional }
- Add( 'Unidirectional: ' +
- IntToStr( Integer( bUniDirectional )));
- { Table rights }
- Add( 'Table Rights: ' + IntToStr( Integer( eprvRights )));
- { Family rights }
- Add( 'Family Rights: ' + IntToStr( iFmlRights ));
- { Number of Aux passwords }
- Add( 'Auxliliary Passwords: ' + IntToStr( iPasswords ));
- { Codepage (0 if unknown) }
- Add( 'Codepage: ' + IntToStr( iCodePage ));
- { Table is protected by password }
- Add( 'Protected: ' + IntToStr( Integer( bProtected )));
- { Driver dependent table level }
- Add( 'Driver Table Level: ' + IntToStr( iTblLevel ));
- { Language driver name }
- Add( 'Language Driver: ' + StrPas( szLangDriver ));
- { Field map active }
- Add( 'Field Map On: ' + IntToStr( Integer( bFieldMap )));
- { Physical file blocksize in K }
- Add( 'Block Size (K): ' + IntToStr( iBlockSize ));
- { Strict referential integrity }
- Add( 'Strict RI: ' + IntToStr( Integer( bStrictRefInt )));
- { Number of filters }
- Add( 'Number of Filters: ' + IntToStr( iFilters ));
- { Table is a temporary table }
- Add( 'Temporary: ' + IntToStr( Integer( bTempTable )));
- end;
- end;
-
- procedure TTablePropertyForm.SaveToFileButtonClick(Sender: TObject);
- var
- TheFileName: String;
- begin
- if PropertyListBox.Items.Count = 0 then
- begin
- messageBeep( $FFFF );
- ShowMessage( 'No properties to save.');
- exit
- end;
- if SelectedTable.Database.IsSqlBased then
- begin
- TheFileName := Copy( SelectedTable.TableName, 1, 8 );
- end
- else { Table is local }
- begin
- if Pos( '.', SelectedTable.TableName) > 0 then
- begin
- TheFileName := Copy(
- SelectedTable.TableName,
- 1,
- Pos( '.', SelectedTable.TableName) - 1
- );
- end
- else
- begin
- TheFileName := SelectedTable.TableName;
- end;
- end;
- SaveToFileDialog.FileName := TheFileName;
- if SaveToFileDialog.Execute then
- begin
- PropertyListBox.Items.SaveToFile(SaveToFileDialog.FileName);
- end;
- end;
-
- end.
-